﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;

namespace Spacer {
	public static partial class Input {
		private static void UCMD_Up_Press( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].SetKeyDown( CommandKeys.Up );
		}
		private static void UCMD_Up_Release( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].UnsetKeyDown( CommandKeys.Up );
		}

		private static void UCMD_Down_Press( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].SetKeyDown( CommandKeys.Down );
		}
		private static void UCMD_Down_Release( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].UnsetKeyDown( CommandKeys.Down );
		}

		private static void UCMD_Left_Press( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].SetKeyDown( CommandKeys.Left );
		}
		private static void UCMD_Left_Release( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].UnsetKeyDown( CommandKeys.Left );
		}

		private static void UCMD_Right_Press( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].SetKeyDown( CommandKeys.Right );
		}
		private static void UCMD_Right_Release( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].UnsetKeyDown( CommandKeys.Right );
		}

		private static void UCMD_Attack_Press( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].SetKeyDown( CommandKeys.Attack );
		}
		private static void UCMD_Attack_Release( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].UnsetKeyDown( CommandKeys.Attack );
		}

		private static void UCMD_Attack2_Press( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].SetKeyDown( CommandKeys.Attack2 );
		}
		private static void UCMD_Attack2_Release( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].UnsetKeyDown( CommandKeys.Attack2 );
		}

		private static void UCMD_Jump_Press( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].SetKeyDown( CommandKeys.Jump );
		}
		private static void UCMD_Jump_Release( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			s_arrUserCommands[(int)ePlayer].UnsetKeyDown( CommandKeys.Jump );
		}

		// ----------

		/*private static void CONCMD_Exit( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			Main.Instance.Exit();
		}*/

		private static void CONCMD_NextItem( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			/*foreach(Entity ent in Main.Entities) {
				if( ent.GetType() == typeof(Pawn) && ((Pawn)ent).ControllingPlayer == ePlayer ) {
					if( ((Pawn)ent).ActiveItem != null )
						((Pawn)ent).ActiveItem.Rendering = false;

					((Pawn)ent).ActiveItemIndex++;
					if( ((Pawn)ent).ActiveItemIndex >= ((Pawn)ent).Items.Count )
						((Pawn)ent).ActiveItemIndex = 0;

					if( ((Pawn)ent).ActiveItem != null )
						((Pawn)ent).ActiveItem.Rendering = true;

					break;
				}
			}*/
		}

		private static void CONCMD_PrevItem( PlayerIndex ePlayer, string strCmd, string[] arrArgs ) {
			/*foreach(Entity ent in Main.Entities) {
				if( ent.GetType() == typeof(Pawn) && ((Pawn)ent).ControllingPlayer == ePlayer ) {
					if( ((Pawn)ent).ActiveItem != null )
						((Pawn)ent).ActiveItem.Rendering = false;

					((Pawn)ent).ActiveItemIndex--;
					if( ((Pawn)ent).ActiveItemIndex < 0 )
						((Pawn)ent).ActiveItemIndex = ((Pawn)ent).Items.Count - 1;

					
					if( ((Pawn)ent).ActiveItem != null )
						((Pawn)ent).ActiveItem.Rendering = true;

					break;
				}
			}*/
		}
	}
}
